<html>
 <head>
	<title>[var.TITLE]</title>
	<link href="[var.ROOT_CSS_DIR]/main.css" rel="STYLESHEET" type="text/css" charset="iso-8859-1" hreflang="en-us">
	<link href="[var.ROOT_CSS_DIR]/facet/style.css" rel="STYLESHEET" type="text/css" charset="iso-8859-1" hreflang="en-us">	
	<script type="text/javascript" src="[var.ROOT_DIR]js/common.js"></script>	
	<script type="text/javascript" src="[var.ROOT_DIR]js/jsformgrid.php?session=[var.SessionVar]"></script>
	<script type="text/javascript" src="[var.ROOT_DIR]js/jsmasks.js"></script>
	<script type="text/javascript" src="[var.ROOT_DIR]js/jsverify.php?session=[var.SessionVar]"></script>	
	<script type="text/javascript" src="[var.ROOT_DIR]js/jsinit.php?session=[var.SessionVar]"></script>	
 </head>
<body bgcolor="FFFFFF" topmargin="0" leftmargin="0" bottommargin="0" marginheight="0" marginwidth="0">
<iframe id="CLoader" style="display:none;"></iframe>
	<table border="0" cellspacing="0" cellpadding="0" width="100%">
	    <tr>
	      <td>
	 <!-- GRID SECTION -->
			<table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">
			<form method=post name="[var.HTMLGridForm]" onsubmit="TransferData();self.close();">
			  <tr>
			    <td nowrap class="FacetColumnTD" align="center">Activity</td>
			  	<td nowrap class="FacetColumnTD" align="center">Quantity</td>
			  	<td nowrap class="FacetColumnTD" align="center">X</td>
			    <td nowrap class="FacetColumnTD" align="center">Tarif</td>
			    <td nowrap class="FacetColumnTD" align="center">=</td>
			    <td nowrap class="FacetColumnTD" align="center">Total</td>
			  </tr>
			  <tr>
			    <td class="FacetDataTD">
  				<select name="act" class="input" onchange="GetTarif(this.value);">
  					  <option value="">-</option>
              <option value="[actblk.kdtools]">[actblk.kdtools;block=option]</option>
  				</select>			    
			    </td>
			    <td class="FacetDataTD" align="center">
			    <input type="text" name="qty" value="1" maxlength="255" size="4" class="inputNumber" onkeyup="Calculate();">
			    </td>
			    <td class="FacetDataTD" align="center">X</td>
			    <td class="FacetDataTD" align="center">
				<input type="text" name="tarif" value="0.00" maxlength="255" size="10" class="inputNumber" onkeyup="Calculate();">
			    </td>
			    <td class="FacetDataTD" align="center">=</td>
			    <td class="FacetDataTD" align="center">
			    <input type="text" name="total" value="0.00" maxlength="255" size="20" class="inputNumber" readonly>
			    </td>
			  </tr>
			  <tr>
			    <td nowrap class="FacetColumnTD" align="right" colspan="6">
					<table border="0" cellspacing="2" cellpadding="0">
						<tr>
					   		<td>
					   		<input name="FormAction" type="button" value="Ok" class="button" onclick="TransferData();self.close();">
					   		</td>							   		
					   		<td>
					   		<input name="FormAction" type="button" value="Cancel" class="button" onclick="self.close();">
					   		</td>
						</tr>
					</table>			    
			    </td>
			  </tr>			  
		    </form>
			</table>
	<!-- GRID SECTION -->
	       </td>						      
	 	</tr>
	</table>
</body>
<script>
[var.InitFunction]

function GetTarif(val) {
	LoadRPC ("CLoader", "[var.FileName]", "kdtools="+val+"&ppn=[var.FormPPN]"+"&skada=[var.FormSkada]");
}

function Calculate() {
  var total = 0;
  var PPNValue = [var.FormPPN];
  var tarif =	document.[var.HTMLGridForm].tarif.value;
  var qty   = document.[var.HTMLGridForm].qty.value;
  if (PPNValue==1)  total = StrToNumber(qty)*StrToNumber(tarif)*100/110;
  else  total = StrToNumber(qty)*StrToNumber(tarif);
  oMask = new Mask('#,###.#0', 'number');
  //total = oMask.format(total);
  document.[var.HTMLGridForm].total.value = total.toFixed(2);

}

function TransferData () {
 window.opener.document.[var.FormName].[var.FormAct].value = document.[var.HTMLGridForm].act.value;
 window.opener.document.[var.FormName].[var.FormQty].value = document.[var.HTMLGridForm].qty.value;
 window.opener.document.[var.FormName].[var.FormTarif].value = document.[var.HTMLGridForm].tarif.value; 
 	
 window.opener.document.[var.FormName].[var.FormDesc].value  = document.[var.HTMLGridForm].qty.value+" "+document.[var.HTMLGridForm].act.value+" X "+document.[var.HTMLGridForm].tarif.value;
 window.opener.document.[var.FormName].[var.FormTotal].value = document.[var.HTMLGridForm].total.value;
 var jumlah = window.opener.SumTotal("jumlah");
 window.opener.document.[var.FormName].total_trans.value = jumlah[0];
 window.opener.document.[var.FormName].total_ppn.value = jumlah[1];
}
</script>
</html>
